import { BaseVoice } from 'orionos-eve-core';
import { BookViewModel } from './BookViewModel';

export class BookVoice extends BaseVoice {
    private viewModel: BookViewModel;
    public constructor(viewModel: BookViewModel) {
        super('BookVoice')
        this.viewModel = viewModel
    }
    public onListenCallback(intent: string, result: any, id: number, text: string): boolean {
        console.log(text)
        this.viewModel.setInfoText(`intent:${intent}&${text}`);
        if(/我想查找/.test(text)){
            this.viewModel.searchBook(text.replace(/^.*我想查找/, ''))
            return true
        }
        return false
    }
    public speak(): void{

    }
}